<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_title" data-rule="required" class="form-control" name="row[h_title]" type="text" value="{$row.h_title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">副标题[属性]:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-h_attr" class="form-control " rows="5" name="row[h_attr]" placeholder="如：实拍 舒适 1居1床2人 换行 用'|' 分割，前端根据 '|' 换行 " cols="50">{$row.h_attr}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间编号:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="h_housebrand" data-rule="required" class="form-control" name="row[h_housebrand]" type="text" value="{$row.h_housebrand|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-thumb" class="control-label col-xs-12 col-sm-2">房间图片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumb" class="form-control" size="35" name="row[h_imgs]" type="text" value="{$row.h_imgs}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-thumb" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-thumb" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-thumb"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">选择酒店:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-type" data-rule="required" class="form-control" name="row[h_id]" onchange="show_sub(this.options[this.options.selectedIndex].value)">
                {foreach name="hotelList" item="vo"}
                    <option {if $row.h_id == $vo.hid} selected {/if} value="{$vo.hid}">{$vo.h_title}</option>

                {/foreach}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">选择楼层[单元]:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-h_storey" data-rule="required" class="form-control" name="row[h_storey]">
                {foreach name="hotelNumArr" item="vo"}
                    <option {if $row.h_storey == $vo} selected {/if} value="{$vo}">{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">单价[时]:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_price" data-rule="required" class="form-control" step="0.01" name="row[h_price]" type="number"  value="{$row.h_price|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">价格日历:</label>
        <div class="col-xs-12 col-sm-8">
            <a  href='{:url("/calendar?id=$ids")}' class="btn btn-success btn-dialog">价格日历</a>
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间总价:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_allprice" data-rule="required" class="form-control" step="0.01" name="row[h_allprice]" type="number"  value="{$row.h_allprice|htmlentities}">
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间设施:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_servs" value="{$row['h_servs']}">
            <div class="col-xs-12 col-sm-8" id="h_servsval">
                {foreach $serviceList as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_servs[]" value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">基础设施:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_service" value="{$row['h_service']}">
            <div class="col-xs-12 col-sm-8"  id="h_serviceval">
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]"  value="1"> 无线网
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]"  value="2"> 电梯
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]"  value="3"> 落地窗
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]"  value="4"> 空调
                </label>

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">卫浴设施:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_service2" value="{$row['h_service2']}">
            <div class="col-xs-12 col-sm-8" id="h_service2val">

                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]"  value="1"> 热水
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]"  value="2"> 独立卫浴
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]"  value="3"> 电吹风
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]"  value="4"> 洗浴用品
                </label>

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">入住须知:</label>
        <div class="col-xs-12 col-sm-8">
                <input type="hidden" id="hreads" value="{$row['h_read']}">
            <div class="col-xs-12 col-sm-8" id="hreadsval">
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox" name="h_read[]" value="1"> 接待儿童
                    </label>

                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="2"> 接待老人
                    </label>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="3"> 接待外宾
                    </label>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="4"> 带宠物
                    </label>
                    <br>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="5"> 吸烟
                    </label>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="6"> 做饭
                    </label>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="7"> 聚会
                    </label>
                    <label class="checkbox-inline checkbox" style="line-height: 24px;">
                        <input type="checkbox"  name="h_read[]"  value="8"> 商拍
                    </label>




            </div>
        </div>
    </div>


    <div class="form-group">
        <label for="c-editor" class="control-label col-xs-12 col-sm-2">房间详情:</label>

        <div class="col-xs-12 col-sm-8">
            <textarea name="row[h_content]" id="c-editor" cols="60" rows="5" class="form-control">{$row.h_content|htmlentities}</textarea>
        </div>

    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[h_status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['h_status'])}
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    //下拉框切换
    function show_sub(v){
        $.ajax({
            type: "POST",
            url: "house/AjaxHotelNum",
            data: {hotelid:v},
            dataType: "json",
            success: function(data){
                if(data["msg"] == "error"){
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    layer.alert("酒店楼层数据有误,请检查酒店参数");
                    return
                }else{
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    var html = '';
                    $.each(data.data, function(commentIndex, comment){
                        html += '<option value="'+ comment +'">'+ comment +'</option>';
                    });
                    $('#c-h_storey').html(html);
                }

            }
        });
    }







</script>
